﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ajeelee.Core.Database;
using Ajeelee.Core.Utils;
using FxhjpgWeb.Business;
using FxhjpgWeb.Model;
using FxhjpgWeb.WebSite.Code;

namespace FxhjpgWeb.WebSite.pfdn
{
    public partial class salesnetwork : PageBase
    {
        protected int aid;
        protected string cname;
        Hashtable table = new Hashtable();
        protected IList<News> newList = new List<News>();
        INewsBusiness newBll = new NewsBusinessFactory().CreateNewsBusiness();
        protected PageStructure ps = new PageStructure() { CurrPage = 1, PageSize = 12 };

        protected void Page_Load(object sender, EventArgs e)
        {
            aid = QueryParamInt32("id");
            // 接收参数
            if (QueryParamInt32("page") > 1)
            {
                ps.CurrPage = QueryParamInt32("page");
            }

            try
            {
                //table.Add(NewsHash.CId, aid);
                // 读取分页数据
                if (aid > 0)
                {
                    table.Add(NewsHash.ProvCode, aid.ToString());
                }
                table.Add(NewsHash.CId, 16);
                newList = newBll.GetAllNewsByPage(table, ps);
                this.pager.PageStruct = ps;
                this.pager.TargetUrlFormat = "/pfdn/salesnetwork.aspx?page={thispage}" + (aid > 0 ? "&id=" + aid : "");
            }
            catch (Exception ex)
            {
                Function.WriteErrorLog(ex);
            }
        }
    }
}